﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NCmd;

public class NetRegister : Singleton<NetRegister>
{
    HashSet<Type> _notLogCmd = new HashSet<Type>();

    public void Init(Dictionary<Type, Action<Cmd>> cache)
    {
        //cache.Add(typeof(RoleList), SelectRoleMgr.OnCreatedRoleList);

        initNotLog();
    }

    private void initNotLog()
    {
        //_notLogCmd.Add(typeof(MoveReq);
    }

    public void CheckAndLogSend(Cmd cmd)
    {
        if (_notLogCmd.Contains(cmd.GetType())) { return; }

        Utils.LogWithColor(LitJson.JsonMapper.ToJson(cmd), "[client send]", "green");
    }
    public void CheckAndLogRecive(Cmd cmd)
    {
        if (_notLogCmd.Contains(cmd.GetType())) { return; }

        Utils.LogWithColor(LitJson.JsonMapper.ToJson(cmd), "[client recive]", "red");
    }
}
